<template>
  <div class="page">
    <h2>Home Page</h2>
    <el-button type="primary" @click="testAxios()">测试axios调用</el-button>
    <el-button type="primary" @click="getUser()">获取用户信息</el-button>
    <el-button type="primary" @click="getMenu()">获取菜单信息</el-button>
  </div>
</template>

<script>
  import axios from 'axios'
  import mock from '@/mock/mock.js'
  import ElButton from "element-ui/packages/button/src/button";

  export default {
    components: {ElButton},
    name: 'Home',
    methods: {
      testAxios() {
        axios.get('http://localhost:8088')
          .then(function (res) {
            alert(res.data);
          }).catch(function (res) {
          alert(res);
        })
      },
      getUser() {
        axios.get('http://localhost:8088/user')
          .then(function (res) {
            alert(JSON.stringify(res.data));
          }).catch(function (res) {
          alert(res);
        })
      },
      getMenu() {
        axios.get('http://localhost:8088/menu')
          .then(function (res) {
            alert(JSON.stringify(res.data));
          }).catch(function (res) {
          alert(res);
        })
      }
    }
  }
</script>
